import React, { Component } from 'react';
import styles from './index.css';
import {connect} from 'dva';
import TopControl from '../component/TopControl/topControl';
import '../assets/css/common/public.css';

const genBasicLayout=(props)=>{
  console.log(props)
  const { children, loading, location: { pathname = '/' }, route: { routes }, } = props;
  const topControl={ 
    handleTabClick(theModule){   //跳转
      props.history.push(`./${theModule}`) ;
      props.dispatch({
          type:'main/updateMudule',
          payload:{
            pageIndex:theModule, 
        } 
      })
    }, 
    history:props.history
  }
  return (
    <div className={styles.headContent}>
       <TopControl {...topControl}/>  
      <div className={styles.bodyContent}>
           {children}   
      </div>
    </div>
   
  );
}
class BasicLayout extends Component {
  render() {
    return (
       genBasicLayout(this.props)
    );
  }
}

export default connect(({main})=>({
  main
}))(BasicLayout);

 